package wangm.netty.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * describe
 *
 * @author zk
 * @date 2018-02-09 8:57
 */
public class ServerInBoundHandlerString extends ChannelInboundHandlerAdapter{
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        if (msg instanceof String) {
            String s = (String) msg;
            System.out.println("接受了字符串：" + s);
        }else if (msg instanceof Integer) {
            Integer in = (Integer) msg;
            System.out.println("接受了Integer:" + in);
        }else{
            System.out.println("String handler 接受了别的类型：" + msg.getClass().getTypeName() + "  ,value = " + msg);
        }
    }
}
